package com.atguigu06.otherstream;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * ClassName: Looger
 * Package: com.atguigu06.otherstream
 * Description:
 *      Logger.log
 * @Author BuTang
 * @Create 2023/6/20 10:05
 * @Version 1.0
 */
public class Looger {
    public static void log(String msg) throws FileNotFoundException {
        OutputStream o = new FileOutputStream("abc.txt");
        PrintStream out = new PrintStream(o);
        System.setOut(out);
        Date nowdate = new Date();
        SimpleDateFormat sim = new SimpleDateFormat("yy-MM-dd HH-mm-ss SSS");
        String time = sim.format(nowdate);
        System.out.println(time + '\t'+msg);
    }
}
